<template>
	<view class=" bg-white padding min-height-100">
		<EventList ref="RefData" @clickItem="clickItem" />
	</view>
</template>

<script>
	import EventList from "./components/EventList.vue"
	import {
		EventStatusMap,
		EventStatusEnum
	} from "@/enums/event"
	export default {
		components: {
			EventList
		},
		data() {
			return {
				searchObj: {
					pageNum: 1,
					pageSize: 10,
					status: null,
					history: null
				},
			}
		},
		onPullDownRefresh() {
			this.getDatas(this.$ListLoadEnum.load)
		},
		onReachBottom() {
			this.getDatas(this.$ListLoadEnum.bottom)
		},
		onLoad(options) {
			const status = Number(options.status);
			this.searchObj.history = options.history;
			uni.$u.test.number(status) && (this.searchObj.status = status);
		},
		onShow() {
			this.$nextTick(() => {
				this.getDatas(this.$ListLoadEnum.load)
			})
		},
		methods: {
			getDatas(type) {
				this.$refs.RefData.loadDatas(type, this.searchObj)
			},
			clickItem(e) {
				console.log("event-list-item", e);
				this.$jump({
					to: "/pages/event/event/detail",
					query: {
						id: e.eventId,
						currentNodeId: e.currentNodeId,
						nextNodeId: e.nextNodeId,
						taskId: e.current_task_id,
						lat: e.lat,
						lon: e.lon,
						status: this.searchObj.status,
						eventSubclass: e.eventSubclass,
						eventTypeId: e.eventTypeId,
						instanceId: e.instanceId,
						history: this.searchObj.history
					}
				})
			},
		},
	}
</script>

<style lang="less" scoped>
</style>